package com.example.app.dao

import com.example.app.bean.KL8
import com.example.app.bean.User
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Options
import org.apache.ibatis.annotations.Select
import org.springframework.stereotype.Repository

@Repository
interface KL8Repository {

    @Select("SELECT * FROM KL8")
    fun findAll(): List<KL8>

    @Insert("INSERT INTO KL8(id,number,issueno,opendate) VALUES(#{id}, #{number}, #{issueno}, #{opendate})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    fun insert(kl: KL8)

    @Select("SELECT * FROM KL8 WHERE issueno = #{issueno}")
    fun findByIssueno(issueno: String): KL8

    @Select("SELECT * FROM KL8 WHERE opendate = #{opendate}")
    fun findByOpendate(opendate: String): KL8

    @Select("SELECT * FROM KL8 WHERE id = #{id}")
    fun findById(id: String): KL8
}
